const mongoose = require("mongoose");
const supplierSchema = new mongoose.Schema({
    supplierName: String,
    supplierTel: String,
    supplierDate: Number,
    supplierOrigin:[{ type: mongoose.Schema.Types.ObjectId, ref: "bill" }],
    supplierAmount: Number,
    supplierCode: String,
    createTime: String,
    supplierunpaid: Number,
    supplierInvoice: String,
    supplierIsSend: {
        type: Boolean,
        default: false
    },

    fileList: [
        {
            name: String,
            url: String,
            id: String
        }
    ],
    product: [
        {
            pid: { type: mongoose.Schema.Types.ObjectId, ref: "supplierProduct" },
            number: {
                type: Number,
                required: true
            },
            name: String,
            iprice: Number,
            price: [Number],
            specification: [String],
            ispecification:String,
            unit: String,
            desc: String,
        },
    ], // 引用产品模型

});
const supplier = mongoose.model("supplier", supplierSchema);

module.exports = {
    supplier
};
